package com.xuelang.pipeline.client.resource;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.resource.dto.DictDTO;
import com.xuelang.pipeline.client.resource.dto.DictQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 字典服务API
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface IDictService {

    /**
     * 查询字典列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<DictDTO>> pageDictList(@RequestBody @Valid PageParam<DictQuery> dtoPageParam);

    /**
     * 查询字典列表(有过滤条件)
     *
     * @param dictQuery
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<DictDTO>> conditionalDictList(@RequestBody @Valid DictQuery dictQuery);

    /**
     * 新增字典
     *
     * @param dictDTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addDict(@RequestBody @Valid DictDTO dictDTO);

    /**
     * 更新字典
     *
     * @param dictDTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateDict(@RequestBody @Valid DictDTO dictDTO);

    /**
     * 删除字典
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteDict(@PathVariable("id") Long id);

    /**
     * 查询字典
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/{id}", produces = "application/json;charset=utf-8")
    ApiResult<DictDTO> queryDict(@PathVariable("id") Long id);
}
